package gestion.camping.vue;

import gestion.camping.dto.Tarif;
import gestion.camping.utils.MessagesUtil;

import java.util.List;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;

public class TableTarif extends JTable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 4325502755576282487L;

	public TableTarif(List<Tarif> listTarif) {
	    String [] columnNames = getColumnNames();
	    setModel(new TableTarifModel(listTarif, columnNames));
	    this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	}
	
	public TableTarif(){
		setModel(new TableTarifModel(null, getColumnNames()));
		this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	}
	
	public String [] getColumnNames() {
		String [] columnsTitle = {MessagesUtil.formatMessage("tarif.liste.table.saison"),
								  MessagesUtil.formatMessage("tarif.liste.table.typelocation"), 
								  MessagesUtil.formatMessage("tarif.liste.table.prix")};

	    return columnsTitle;
	}
}
